package java_thinking.unit_16;

import java_thinking.net.mindview.util.Generated;
import java_thinking.unit_15._15_3.Generator;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @Desc:   修改ContainerComparison，创建一个用于BerylliumSphere的Generator，
 *          并修改main()方法，再将这个Generator作用于Generated.array()
 * @author: cww
 * @DateTime: 2019-04-09 20:54
 */
class BSGenerator implements Generator<BerylliumSphere> {
    @Override
    public BerylliumSphere next() {
        return new BerylliumSphere();
    }
}
public class E15_BSContainerComparison {
    public static void main(String[] args) {
        BSGenerator bsGenerator = new BSGenerator();
        BerylliumSphere[] spheres = Generated.array(BerylliumSphere.class,bsGenerator,5);
        System.out.println(Arrays.toString(spheres));
        List<BerylliumSphere> sphereList = Arrays.asList(Generated.array(BerylliumSphere.class, bsGenerator, 5));
        System.out.println(sphereList);
        System.out.println(sphereList.get(4));

        int[] integers = { 0, 1, 2, 3, 4, 5 };
        System.out.println(Arrays.toString(integers));
        System.out.println(integers[4]);

        List<Integer> intList = new ArrayList<Integer>(Arrays.asList(0, 1, 2, 3, 4, 5));
        intList.add(97);
        System.out.println(intList);
        System.out.println(intList.get(4));
    }
}
